import request from '@/utils/request'

// 根据用户ID获取公众号账号列表
export function listByUserId() {
  return request({
    url: '/wx/account/listByUserId',
    method: 'get'
  })
}
// 公众号账号列表
export function listWxAccount(query) {
  return request({
    url: '/wx/account/list',
    method: 'get',
    params: query
  })
}

// 查询公众号账号详细
export function getWxAccount(configId) {
  return request({
    url: '/wx/account/' + configId,
    method: 'get'
  })
}

// 根据公众号账号键名查询公众号账号值
export function getConfigKey(configKey) {
  return request({
    url: '/wx/account/configKey/' + configKey,
    method: 'get'
  })
}

// 新增公众号账号配置
export function addWxAccount(data) {
  return request({
    url: '/wx/account/create',
    method: 'post',
    data: data
  })
}

// 修改公众号账号配置
export function updateWxAccount(id,data) {
  return request({
    url: '/wx/account/update/' + id,
    method: 'put',
    data: data
  })
}

// 删除公众号账号配置
export function delWxAccount(configId) {
  return request({
    url: '/wx/account/deleteByIds/' + configId,
    method: 'delete'
  })
}

// 导出公众号账号
export function exportWxAccount(query) {
  return request({
    url: '/wx/account/export',
    method: 'get',
    responseType:'blob',
    params: query
  })
}
